import {defineComponent} from 'friendly-petite-vue'
import MiniDatagrid from './MiniDatagrid'
import ExcelPaster from './ExcelPaster'


export default defineComponent('App', props => {
    return {
        components: {
            MiniDatagrid,
            ExcelPaster
        },    
        template: `
        <div class="layui-tab layui-tab-brief">
            <button class="layui-btn" @click="handleSearchDialogClick">查询</button>
            <button class="layui-btn" @click="handleImportClick">导入</button>
        </div>
        <div v-scope="MiniDatagrid({id: 'dg', searchUrl: '/search', openSearchDialog: $on('openSearchDialog'), doSearch: $on('doSearch')})"></div>
        <div v-scope="ExcelPaster({openExcelPaster: $sub('openExcelPaster')})"></div>
        `,
        mounted() {
            this.$emit('doSearch')
        },
        methods: {
            handleSearchDialogClick() {
                this.$emit('openSearchDialog')
            },
	        handleImportClick() {
                this.$emit('openExcelPaster')
	        }
        }
    }
})

